﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConceptionLogiciel_Devoir1
{
    class Disponibilite
    {
        private Boolean enLocation;
        private DateTime dateDebutReservation;
        private DateTime dateFinReservation;

        // Constructor
        // -------------------------------------------------------------------------------
        public Disponibilite()
        {
            this.enLocation = false;
            this.dateDebutReservation = DateTime.Today.AddDays(-1);
            this.dateFinReservation = DateTime.Today.AddDays(-1);
        }

        public Disponibilite(Boolean _enLocation, DateTime _dateDebutReservation,
                DateTime _dateFinReservation)
        {
            this.enLocation = _enLocation;
            this.dateDebutReservation = _dateDebutReservation;
            this.dateFinReservation = _dateFinReservation;
        }

        // Getters && setters
        // -------------------------------------------------------------------------------
        public Boolean EnLocation
        {
            get { return enLocation; }
            set { this.enLocation = value; }
        }

        public DateTime DateDebutReservation
        {
            get { return dateDebutReservation; }
            set { this.dateDebutReservation = value; }
        }

        public DateTime DateFinReservation
        {
            get { return dateFinReservation; }
            set { this.dateFinReservation = value; }
        }

        // Définir disponibilite
        public void editDisponibilite(Boolean _enLocation, DateTime _dateDebutReservation,
                                                           DateTime _dateFinReservation)
        {
            this.enLocation = _enLocation;
            this.dateDebutReservation = _dateDebutReservation;
            this.dateFinReservation = _dateFinReservation;
        }

        // Retourne vrai, s'il n'y a pas de location et de réservation sur le véhicule
        // -------------------------------------------------------------------------------
        public Boolean getDisponibilite()
        {
            return (getLocationDisponibilite() && getReservationDisponibilite());
        }

        // Retourne vrai, s'il n'y a pas de location sur le véhicule
        // -------------------------------------------------------------------------------
        private Boolean getLocationDisponibilite()
        {
            return (!enLocation);
        }

        // Retourne vrai, s'il n'y a pas de réservation sur le véhicule
        // -------------------------------------------------------------------------------
        private Boolean getReservationDisponibilite()
        {
            // À implémenter ..., car  
            // ne correspond pas au cas d'utilisation à développer
            return true;
        }

    }  // End class Disponibilite
}  // End namespace devoir3_conception_location
